package com.tcgroup.phone.base_core.utils;

import android.os.Build;
import android.util.DisplayMetrics;
import android.view.Window;

/**
 * 作者: wangfei
 * 创建时期: 2020/5/14.
 * 包名: com.tcgroup.phone.base_core.utils
 * 类名: OSAndroidMvvm
 */
public class PackageUtil {


    public static Integer[] getWidthAndHeight(Window window){
        if (null == window){
            return null;
        }
        Integer[] integers = new Integer[2];
        DisplayMetrics displayMetrics = new DisplayMetrics();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
            window.getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
        }else {
            window.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        }
        integers[0] = displayMetrics.widthPixels;
        integers[1] = displayMetrics.heightPixels;
        return integers;
    }

}
